﻿{extend name="public:base" /}

{block name="css"}
<style>
    .star-box{
        display: flex;
    }
    .star-box img{
        width: 40px;
        height: 40px;
    }
</style>
{/block}

{block name="content"}

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox ">
                <div class="ibox-content">
                    <form method="post">
                        <div class="box-item">
                            <div class="form-group row">
                                <label class="col-sm-1 col-form-label">评价用户</label>
                                <div class="col-sm-3">
                                    <select class="form-control" name="user_id">
                                        <option value="0">请选择</option>
                                        {volist name="user_list" id="vo"}
                                        <option value="{$vo.id}">{$vo.username} / {$vo.mobile}</option>
                                        {/volist}
                                    </select>
                                    <span class="form-text m-b-none"></span>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>


                        <div class="box-item">
                            <div class="form-group row">
                                <label class="col-sm-1 col-form-label">评价图片</label>
                                <div class="col-sm-3">
                                    <input type="file" id="imgs_file" multiple style="display: none">
                                    <input type="hidden" name="imgs" id="imgs" value="{$info['imgs']|default=''}"/>
                                    <div id="imgs_div">
                                        <!-- 已上传图片盒子 -->
                                        {volist name="info.imgs_arr" id="vo"}
                                        <div class="upload-files-div">
                                            <img class="upload-files" src="{$vo.path}"/><span class="upload-file-del" onclick="delThisPic(this)">删除</span>
                                        </div>
                                        {/volist}
                                    </div>
                                    <img class="upload-file" onclick="uploadImgs('imgs_file', 'imgs', 'imgs_div')" src="__ADMIN__/img/uploadBtn.png" id="upload_imgs">
                                </div>

                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>

                        <div class="box-item">
                            <div class="form-group row">
                                <label class="col-sm-1 col-form-label">评论内容</label>
                                <div class="col-sm-3">
                                    <textarea class="form-control" name="content" rows="8">{$info.content}</textarea>
                                    <span class="form-text m-b-none"></span>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>

                        <div class="box-item">
                            <div class="form-group row">
                                <label class="col-sm-1 col-form-label">评星</label>
                                <div class="col-sm-3">
                                    <div class="star-box">
                                        <img src="__ADMIN__/img/star-active.png" data-star="1" onclick="clickStar(this)">
                                        <img src="__ADMIN__/img/star-active.png" data-star="2" onclick="clickStar(this)">
                                        <img src="__ADMIN__/img/star-active.png" data-star="3" onclick="clickStar(this)">
                                        <img src="__ADMIN__/img/star-active.png" data-star="4" onclick="clickStar(this)">
                                        <img src="__ADMIN__/img/star-active.png" data-star="5" onclick="clickStar(this)">
                                    </div>
                                    <input type="hidden" class="star" name="star" value="5">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>

                        <input type="hidden" name="goods_id" value="{:input('goods_id')}">

                        <div class="form-group row">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button type="button" class="btn btn-w-m btn-default back-page">返回</button>
                                <button type="button" class="btn btn-w-m btn-primary ajax-post">提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

{/block}

{block name='js'}
<script>
    function clickStar(that){
        var star = $(that).data('star');
        $('.star').val(star);

        $('.star-box img').each(function (val){
            if(val + 1 <= star){
                $(this).attr('src', '__ADMIN__/img/star-active.png');
            }else{
                $(this).attr('src', '__ADMIN__/img/star.png');
            }
        })
    }
</script>
{/block}
